package com.io;

import org.apache.commons.io.IOUtils;

import java.io.*;

public class ObjectInputStreamTest {
    public static void main(String[] args) {
        InputStream is = null;
        ObjectInputStream ois = null;


        try {
            is = new FileInputStream("/Users/edy/Desktop/file1/object.txt");
            ois = new ObjectInputStream(is);
            Object obj;
            while ((obj = ois.readObject()) != null){
                System.out.println(obj);
            }

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } finally {
            IOUtils.closeQuietly(ois);
            IOUtils.closeQuietly(is);
        }
    }
}
